package com.xzx.redisstudy.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * redis测试
 *
 * @author xinzhixuan
 * @version 1.0
 * @date 2021-05-23 7:06 下午
 */
@RestController
@RequestMapping("")
public class RedisTestController {
    @Autowired
    private RedisTemplate redisTemplate;

    @GetMapping("/test")
    public String test() {
        redisTemplate.opsForValue().set("k1", "v1");
        String value = (String) redisTemplate.opsForValue().get("k1");
        return value;
    }
}
